﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace PassportManage
{
    public partial class Form_MultiPassportChoice : Form
    {
        private ArrayList PositionList;
        public int Pillar;
        public int Layer;
        public int Cell;
        public Form_MultiPassportChoice(ArrayList multi)
        {
            InitializeComponent();
            PositionList = multi;
        }

        private void Form_MultiPassportChoice_Load(object sender, EventArgs e)
        {
            if (PositionList.Count < 1)
            {
                this.Close();
                return;
            }
            for (int i = 0; i < PositionList.Count; i++)
            {
                BLL.Position OutP = (BLL.Position)PositionList[i];
                ListViewItem item=listView1.Items.Add((i+1).ToString());
                item.SubItems.Add(OutP.Pillar.ToString());
                item.SubItems.Add((OutP.Layer-1).ToString());
                item.SubItems.Add((OutP.Cell-1).ToString());
            }
        }

        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0)
                return;
            else
            {
                BLL.Position p = (BLL.Position)PositionList[listView1.SelectedItems[0].Index];
                Pillar = p.Pillar;
                Layer = p.Layer;
                Cell = p.Cell;
                this.DialogResult=DialogResult.OK;
            }
        }
    }
}
